<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <include file="./Application/Home/View/Send/head.html" />
</head>
<body>
<!--菜单栏开始，小屏幕不可见-->
<div id="menu">
    <div class="col-sm-3 col-md-2 sidebar">
        <ul class="nav nav-sidebar">
            <li><a href="<{:U('Home/Send/basic')}>">基础信息</a></li>
            <li class="active"><a href="<{:U('Home/Send/all')}>" >全局数据</a></li>
            <li><a href="<{:U('Home/Send/data')}>">资料管理</a></li>
            <li ><a href="<{:U('Home/Send/verdict')}>">定案表管理</a></li>
        </ul>
    </div>
</div>
<!--菜单栏结束-->
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <div style="float:right; margin-right:50px;">
                <form style="display:inline-block" action="<{:U('send/exportExcel')}>" method="POST" target="_blank">
                    <input type="hidden" name="type" value="all" />
                    <button href="" class="btn btn-default">导出全局数据</button>
                </form>
            </div>
            <h2 class="sub-header" style="display: inline-block; margin-top: 0">全局数据 <{$currentBatch}>
                <div class="btn-group" role="group">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        选择送审批次
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="<{:U('send/all')}>">所有批次</a></li>
                        <volist name="batchList" id="batch">
                            <li><a href="<{:U('send/all', ['batch' => $batch])}>"><{$batch}></a></li>
                        </volist>
                    </ul>
                </div>
<!--                 <div class="btn-group" role="group">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                            aria-haspopup="true" aria-expanded="false">选择送审专业
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="#">核对施工单位</a></li>
                        <li><a href="#">土建专业</a></li>
                        <li><a href="#">铁塔专业</a></li>
                        <li><a href="#">交流专业</a></li>
                        <li><a href="#">配套专业</a></li>
                    </ul>
                </div>
 -->            </h2>
            <!--存储全局数据表格-->
            <div class="table table-responsive ">
                <table class="table table-hover table-bordered table-condensed" style="width:2000px;">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>项目批次</th>
                        <th>内验结束时间</th>
                        <th>批复金额</th>
                        <th>设计金额</th>
                        <th>所属区县</th>
                        <th>立项站名</th>
                        <th>项目编码</th>
                        <th>建设方式</th>
                        <th>分类</th>
                        <th>是否完工</th>
                        <th>备注</th>
                        <th>操作</th>
                        <th>土建单位</th>
                        <th>配套单位</th>
                        <th>铁塔单位</th>
                        <th>交流单位</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="Datas" id="Data">
                        <tr <{$Data['hasConflict'] ? 'class="danger"' : ''}>>
                            <td><{$Data.id}>
                                <!-- Button trigger modal -->
                                <button type="button" class="btn btn-xs btn-lg" data-toggle="modal" data-target="#show-detail-<{$Data.id}>">
                                    查看
                                </button>
                                <!-- Modal -->
                                <if condition="$Data['detail']">
                                    <div class="modal fade show-modal-m" id="show-detail-<{$Data.id}>"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
                                        <div class="modal-dialog  modal-lg" role="document">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                        <span aria-hidden="true">&times;</span></button>
                                                    <h4 class="modal-title" >查看信息</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="panel-group" id="accordion1" role="tablist" aria-multiselectable="true">
                                                        <div role="tab">
                                                            <h5>
                                                                <!--具体施工单位信息-->
                                                                <table class="table table-striped table-condensed table-bordered" style="border: 1px solid #DDDDDD; " >
                                                                    <thead>
                                                                    <tr>
                                                                        <th></th>
                                                                        <th>施工单位</th>
                                                                        <th>送审金额</th>
                                                                        <th>订单金额</th>
                                                                        <th>差异金额</th>
                                                                        <th>差异原因</th>
                                                                        <th>是否提交纸质资料（）</th>
                                                                        <th>是否寄送</th>
                                                                        <th>是否反馈定案表</th>
                                                                        <th>是否寄送</th>
                                                                        <th>备注</th>
                                                                    </tr>
                                                                    </thead>
                                                                    <tbody>
                                                                    <volist name="Data.detail" id="logdata">
                                                                        <tr>
                                                                            <td><a role="button" data-toggle="collapse" data-parent="#accordion1"
                                                                                   href="#collapseOne-<{$logdata.type}>-<{$logdata.project_code}>" aria-expanded="true" aria-controls="collapseOne-<{$logdata.type}>-<{$logdata.project_code}>"><{$logdata.type}></a></td>
                                                                            <td><{$logdata.unit}></td>
                                                                            <td><{$logdata.ecost}></td>
                                                                            <td><{$logdata.ocost}></td>
                                                                            <td><{$logdata.diff}></td>
                                                                            <td><{$logdata.diff_reason}></td>
                                                                            <td><{$logdata.stuff.is_submit_paper}></td>
                                                                            <td><{$logdata.stuff.is_send_paper}></td>
                                                                            <td><{$logdata.stuff.is_feedback_verdict}></td>
                                                                            <td><{$logdata.stuff.is_send_verdict}></td>
                                                                            <td><{$logdata.stuff.remark}></td>
                                                                        </tr>
                                                                    </volist>
                                                                    </tbody>
                                                                </table>
                                                            </h5>
                                                        </div>
                                                        <volist name="Data.detail" id="logdata" key="zy">
                                                            <div id="collapseOne-<{$logdata.type}>-<{$logdata.project_code}>" class="panel-collapse collapse out" role="tabpanel" aria-labelledby="headingOne">
                                                                <div class="table table-responsive ">
                                                                    <br/>
                                                                    <table class="table table-striped table-bordered table-condensed">
                                                                        <thead>
                                                                        <tr>
                                                                            <th>工作量</th>
                                                                            <th>送审金额</th>
                                                                            <th>订单金额</th>
                                                                            <th>差异金额</th>
                                                                            <th>差异原因</th>
                                                                        </tr>
                                                                        </thead>
                                                                        <tbody>
                                                                        <tr>
                                                                            <td><{$logdata.workload}></td>
                                                                            <td><{$logdata.ecost}></td>
                                                                            <td><{$logdata.ocost}></td>
                                                                            <td><{$logdata.diff}></td>
                                                                            <td><{$logdata.diff_reason}></td>
                                                                        </tr>
                                                                        </tbody>
                                                                    </table>
                                                                    <table class="table table-striped table-condensed " style="border: 1px solid #DDDDDD; ">
                                                                        <thead>
                                                                        <tr>
                                                                            <th>序号</th>
                                                                            <th>模块名称</th>
                                                                            <th>模块编号</th>
                                                                            <th>简要工作内容</th>
                                                                            <th style="width: 300px;text-align: center;vertical-align: middle;">数量</th>
                                                                            <th>分类</th>
                                                                        </tr>
                                                                        </thead>
                                                                        <tbody>
                                                                            <volist name="logdata.module" id="module">
                                                                                <tr>
                                                                                    <td style="text-align: left;vertical-align: middle"><{$module.id}></td>
                                                                                    <td style="text-align: left;vertical-align: middle;padding:0px;"><{$module.module_name}></td>
                                                                                    <td style="text-align: left;vertical-align: middle;padding:0px;"><{$module.number}></td>
                                                                                    <td title="<{$module.work_content}>"
                                                                                        style="text-align: left;vertical-align: middle;padding:0px ;max-width:10em"><{$module.work_content}>
                                                                                    </td>
                                                                                    <td style="text-align: center;vertical-align: middle;padding:0px">
                                                                                        <{$module.buynumber}>
                                                                                        <!-- <{$module.singleprice}>&nbsp;X &nbsp;<{$module.buynumber}>&nbsp;=&nbsp;<{$module.total}> -->
                                                                                    </td>
                                                                                    <td style="text-align: left;vertical-align: middle"><{$module.class}></td>
                                                                                </tr>
                                                                            </volist>
                                                                        </tbody>
                                                                    </table>
                                                                    <!-- <p style="text-align: right"> 已选择几个模块 总价5000元</p> -->
                                                                </div>
                                                            </div>
                                                        </volist>
                                                    </div>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <else />
                                    <div class="modal fade show-modal-m" id="show-detail-<{$Data.id}>"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
                                        <div class="modal-dialog modal-sm" role="document">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                        <span aria-hidden="true">&times;</span></button>
                                                    <h4 class="modal-title">提示</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <h4>还未申报或未解决冲突</h4>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default" data-dismiss="modal">确定</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </if>
                            </td>
                            <td ><{$Data.batch}></td>
                            <td ><{$Data.inner_check_time}></td>
                            <td ><{$Data.amount_reply}></td>
                            <td ><{$Data.amount_design}></td>
                            <td ><{$Data.zone}></td>
                            <td ><{$Data.site_name}></td>
                            <td ><{$Data.project_code}></td>
                            <td ><{$Data.construction_type}></td>
                            <td ><{$Data.category}></td>
                            <td ><{$Data.is_complete}></td>
                            <td style="max-width:15em;white-space: nowrap; text-overflow: ellipsis; overflow: hidden;" title="<{$Data.description}>"><{$Data.description}></td>
                            <td>
                                <div class="btn-group btn-group-xs" role="group" aria-label="...">
                                    <!-- <button style="float:left;" type="button" class="btn btn-default"><a href='<{:U("Home/Send/allmod",array("id"=>$Data["id"]))}>'>修改</a></button> -->
                                    <button type="button" class="btn btn-default delete-apply" data-code="<{$Data.project_code}>" data-url="<{:U('emptyApply')}>">删除申报</button>
                                </div>
                                <if condition="$Data['hasConflict']">
                                    <div class="btn-group btn-group-xs" role="group" aria-label="...">
                                            <button type="button" class="btn btn-lg btn-danger btn-block" data-toggle="modal" data-target="#myModal-<{$Data.id}>" >纠正并核对</button>
                                            <div class="modal fade" id="myModal-<{$Data.id}>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                                <div class="modal-dialog" role="document">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                <span aria-hidden="true">&times;</span></button>
                                                            <h4 class="modal-title" id="myModalLabel">纠正并核对：<{$Data.site_name}>-<{$Data.project_code}></h4>
                                                        </div>
                                                        <form class="conflict" action="<{:U('correct')}>" method="POST">
                                                            <div class="modal-body">
                                                                <input type="hidden" name="id" value="<{$Data.id}>" />
                                                                <table class="table table-hover table-bordered table-condensed">
                                                                    <thead>
                                                                        <tr>
                                                                            <th>土建施工单位</th>
                                                                            <th>配套施工单位</th>
                                                                            <th>金加工施工单位</th>
                                                                            <th>交流施工单位</th>
                                                                        </tr>
                                                                    </thead>
                                                                    <tbody>
                                                                        <tr>
                                                                            <td>
                                                                                <select name="tj_unit">
                                                                                    <volist name="Data.unitList.土建专业" id="unit">
                                                                                       <option value="<{$unit}>"><{$unit}></option>
                                                                                    </volist>
                                                                                    <if condition="$Data['unitList']['土建专业'] and !in_array($Data['tj_unit'], $Data['unitList']['土建专业'])">
                                                                                        <option value="<{$Data.tj_unit}>" data-confirm="true">基础信息-<{$Data.tj_unit}></option>
                                                                                    </if>
                                                                                </select>
                                                                            </td>
                                                                            <td>
                                                                                <select name="pt_unit">
                                                                                    <volist name="Data.unitList.配套专业" id="unit">
                                                                                       <option value="<{$unit}>"><{$unit}></option>
                                                                                    </volist>
                                                                                    <if condition="$Data['unitList']['配套专业'] and !in_array($Data['pt_unit'], $Data['unitList']['配套专业'])">
                                                                                        <option value="<{$Data.pt_unit}>" data-confirm="true">基础信息-<{$Data.pt_unit}></option>
                                                                                    </if>
                                                                                </select>
                                                                            </td>
                                                                            <td>
                                                                                <select name="jjg_unit">
                                                                                    <volist name="Data.unitList.铁塔专业" id="unit">
                                                                                       <option value="<{$unit}>"><{$unit}></option>
                                                                                    </volist>
                                                                                    <if condition="$Data['unitList']['铁塔专业'] and !in_array($Data['jjg_unit'], $Data['unitList']['铁塔专业'])">
                                                                                        <option value="<{$Data.jjg_unit}>" data-confirm="true">基础信息-<{$Data.jjg_unit}></option>
                                                                                    </if>
                                                                                </select>
                                                                            </td>
                                                                            <td>
                                                                                <select name="jl_unit">
                                                                                    <volist name="jl.unitList.交流专业" id="unit">
                                                                                       <option value="<{$unit}>"><{$unit}></option>
                                                                                    </volist>
                                                                                    <if condition="$Data['unitList']['交流专业'] and !in_array($Data['jl_unit'], $Data['unitList']['交流专业'])">
                                                                                        <option value="<{$Data.jl_unit}>" data-confirm="true">基础信息-<{$Data.jl_unit}></option>
                                                                                    </if>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
                                                            </div>
                                                            <p>1.选择基础信息单位会删除该专业已申报内容</p>
                                                            <p>2.选择不同于基础信息单位会修改基础信息表中的单位</p>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                                                <button class="btn btn-primary">保存更改并通知施工单位</button>
                                                            </div>
                                                        </form>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </if>
                            </td>
                            <td><{$Data.tj_unit}></td>
                            <td><{$Data.pt_unit}></td>
                            <td><{$Data.jjg_unit}></td>
                            <td><{$Data.jl_unit}></td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
            </div>
            <!--分页-->
            <nav>
                <ul class="pagination" id="page" >
                    <li><a href="<{$urls['all']}>&amp;P=1&amp;batch=<{$currentBatch}>">首页</a></li>
                    <php>
                        for($i=1;$i<=$total;$i++){
                            echo '<li><a href="'.U('all', ['P' => $i, 'batch' => $currentBatch]).'">'.$i.'</a></li>';
                        }
                    </php>
                    <li>
                        <a href="javascript:void(0);" aria-label="Next" onclick="more('<{$T}>','<{:U('all', ['batch' => $currentBatch])}>')">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>

            <p style="text-align: left">1.首先请核对各专业施工单位；凡是同一项目某专业出现多个单位填写的会自动标红请监理核对施工单位。</p>
            <p  style="text-align: left">2.凡是***金额与***金额出现超过15%差距的自动标红，请监理核实原因。</p>
        </div>
    </div>
</div>
<include file="./Application/Home/View/Send/footJs.html" />
<script src="__PUBLIC__/public/JS/send.js"></script>
<script src="__PUBLIC__/static/js/ycom.js"></script>

<script>
$(function(){
    $('.conflict').submit(function(event) {
        Ycom.ajaxForm($(this), function(result) {
            if (result.code == 'ok') {
                location.reload(true);
            } else {
                alert(result.msg);
            }
        });

        return false;
    });

    $('.delete-apply').click(function(event) {
        if(!confirm('是否删除所有申报？')) {
            return false;
        }

        $.ajax({
            url: $(this).data('url'),
            type: 'POST',
            dataType: 'json',
            data: {
                code: $(this).data('code')
            },
        })
        .done(function(result) {
            alert(result.msg);
            if (result.code == 'ok') {
                location.reload(true);
            }
        })
        .fail(function() {
            console.log("error");
        })
        .always(function() {
            console.log("complete");
        });

        return false;
    });
});

</script>
</body>
</html>
